package com.sunlands.zlcx.usercenter.service.status;

import com.sunlands.zlcx.usercenter.domain.UsersTargetRelationDO;
import com.sunlands.zlcx.usercenter.service.status.common.AbstractStudyStatus;
import com.sunlands.zlcx.usercenter.vo.UsersStudyInfoVO;
import org.springframework.stereotype.Component;

/**
 * 归档目标
 *
 * @author gaoyanfeng
 * @create 2019-04-28 13:57
 **/
@Component
public class FileTarget extends AbstractStudyStatus {
    @Override
    public void handle(UsersStudyInfoVO studyInfo, UsersTargetRelationDO targetRelation) {
        studyInfo.setRelateId(targetRelation.getId());
        studyInfo.setStudyInfoName(targetRelation.getTargetName());
        sendMessage(studyInfo.getUserId(), "归档了学习目标" + targetRelation.getTargetName());

        // 保存学习生活
        saveStudyInfo(studyInfo, targetRelation);
        deleteUserTarget(targetRelation, targetRelation.getUserId());

    }
}
